<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
  <style>
    * {
      margin: 0;
      padding: 0;
    }

    canvas {
      border: 2px darkcyan solid;
      margin: 0 150px;
    }

    h6 {
      position: absolute;
      top: 5px;
      left: 230px;
      color: darkcyan;
    }

    ul {
      position: absolute;
      top: 20px;
      left: 155px;
      height: 224px;
      z-index: -30;
    }

    li {
      list-style: none;
      text-align: left;
      width: 439px;
      margin-top: 9.5px;
      font-size: 10px;
      border-bottom: 1px solid darkcyan;
      color: darkcyan;
    }

    #txt {
      width: 400px;
      height: 20px;
      margin-top: -26px;
      display: flex;
      justify-content: space-between;
      margin-left: 175px;
    }

    #txt p {
      font-size: 8px;
      margin-left: 10px;
      color: darkcyan;
    }
  </style>
</head>

<body>
  <canvas id="myCanvas" width="440px" height="250px"></canvas>
  <h6>2015-2020年我国规模以上企业服装产量（亿件）</h6>
  <ul>
    <li>350</li>
    <li>300</li>
    <li>250</li>
    <li>200</li>
    <li>150</li>
    <li>100</li>
    <li>50</li>
    <li>0</li>
  </ul>
  <div id="txt">
    <p>2015</p>
    <p>2016</p>
    <p>2017</p>
    <p>2018</p>
    <p>2019</p>
    <p>2010</p>
  </div>

</body>
<script>
  var canvas = document.querySelector("#myCanvas");
  if (canvas.getContext) {
    var ctx = canvas.getContext("2d");
    ctx.fillStyle = 'pink';
    ctx.fillRect(35, 80, 30, 150);//起点20,20坐标；30,30矩形边长，终点的坐标(50,50)
    ctx.fillStyle = 'blue';
    ctx.fillRect(105, 50, 30, 180);
    ctx.fillStyle = 'yellow';
    ctx.fillRect(178, 60, 30, 170);
    ctx.fillStyle = 'pink';
    ctx.fillRect(250, 60, 30, 170);
    ctx.fillStyle = 'blue';
    ctx.fillRect(325, 80, 30, 150);
    ctx.fillStyle = 'yellow';
    ctx.fillRect(395, 90, 30, 140);

  } else {
    //告诉用户不支持绘画
  }
  console.log(canvas);


</script>

</html>